#ifndef _MYIO_HPP
#define _MYIO_HPP
#include <WinSock2.h>
class MyIO
{
public:
	MyIO():read_cnt(0),read_ptr(nullptr)
	{
		ZeroMemory(_readbuf, sizeof(_readbuf));
	}
	int readline(SOCKET fd, void *vptr, DWORD maxlen);
	int writen(SOCKET fd, const void* vptr, DWORD n);
private:
	MyIO(const MyIO&);
	MyIO &operator=(const MyIO &);
	SSIZE_T my_read(SOCKET fd, char *ptr);
	DWORD read_cnt;
	char *read_ptr;
	static const int DATA_BUFSIZE=4096;
	char _readbuf[DATA_BUFSIZE];
	char _writebuf[DATA_BUFSIZE];
};





#endif
